<?php
/**
 * Created by.
 * User: littleU-569598569
 * Date: 2021/2/1 0001
 * Time: 21:37
 */

namespace app\api\model;


class Admin extends BaseModel
{
    public function role()
    {
        return $this->hasOne('adminRole','id','role_id')->bind(['role_name' => 'name']);
    }
    public function roleMenu()
    {
        return $this->hasMany('adminRoleMenu','role_id','role_id')->where('status',config('code.normal'));
    }

    public static function check($mobile, $password)
    {
        $result = (new self())->where('mobile',$mobile)->where('password',$password)->find();
        return $result;
    }
}